<?php
//商品分类控制器
class TypeController extends BaseController {
	public function indexAction(){

		include CUR_VIEW_PATH . "goods_type_list.html";
	}
	public function addAction(){

		include CUR_VIEW_PATH . "goods_type_add.html";
	}
	public function insertAction(){
		//收集表单数据
		$data['type_name']=trim($_POST['type_name']);
		//做一些验证和处理
		$this->helper('input');
		$data=deepspecialchars($data);//xss过滤
		//调用模型完成入库操作并给出提示
		$data=deepspecialchars($data);//单引号转义
		if($data['type_name']==''){
			$this->jump('index.php?p=admin&c=type&a=add','商品类型名称不能为空');
		}
		$typeModel=new TypeModel('goods_type');
		if($typeModel->insert($data)){
			$this->jump('index.php?p=admin&c=type&a=index','添加成功');
		}else{
			$this->jump('index.php?p=admin&c=type&a=index','添加失败');
		}
	}
	public function editAction(){
		include CUR_VIEW_PATH . "goods_type_edit.html";
	}
	public function updateAction(){

	}
	public function deleteAction(){

	}
}